<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>购物车</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/tuangou.css" rel="stylesheet" type="text/css">
<link href="css/head.css" type="text/css" rel="stylesheet">
<link href="css/style.css" type="text/css" rel="stylesheet">
<link href="css/foot.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="js/request.js"></script>
<script type="text/javascript">
var http_request=null;
function addCollection(itemId){
	http_request=getRequest();
	if (http_request == null) {
		alert("Your browser does not support AJAX!");
		return;
	}
	http_request.onreadystatechange = showMessage;
	http_request.open("GET", "addCollection.do?itemId="+itemId, true);
	http_request.send(null);
}

function showMessage(){
	if (http_request.readyState == 4) {
		alert(http_request.responseText);
	}
}

function changeQty(obj,cartItemId,oldQty){
	var qty=obj.value;
	if(qty<1){
		alert("请填写正确的购买数量.");
		obj.value=oldQty;
		return;
	}
	if(qty==oldQty){
		return;
	}
	window.location.href="updateItem.do?cartItemId="+cartItemId+"&qty="+qty;
}
</script>
</head>
<body>
<#------------------ include header -------------------------------->
<#include "/WEB-INF/view/header.ftl" />
<#------------------ include header -------------------------------->
<div class="share_body">
  <!-- 新鲜蔬菜 -->
  <table class="table3" id="table26" width="100%" bgcolor="#e0e0e0" border="0" cellpadding="5" cellspacing="1">
    <tbody>
      <tr>
        <td class="plist_title4_2" colspan="10" align="left" bgcolor="#fcdbba">购物车 新注册用户从首次购物起可享受一周的超值购物折扣(蔬菜9折,其他商品9.8折)。<br>
          为了响应国家限塑令，自6月1日起，我们对每个包装塑料袋收取0.3元成本费，如您不需要，我们将收回循环利用。谢谢合作！</td>
      </tr>
   <#assign totalAmt=0>  
   <#list orders as order>
      <tr>
        <td class="plist_title4_2" colspan="10" align="left" bgcolor="#fcdbba">${order.deliveryTime}</td>
      </tr>
      <tr>
        <td class="plist_title4_3" width="28%" align="center" bgcolor="#eaeaea">商品名称</td>
        <td class="plist_title4_3" width="10%" align="center" bgcolor="#eaeaea">碧家价</td>
        <td class="plist_title4_3" width="6%" align="center" bgcolor="#eaeaea">数量</td>
        <td class="plist_title4_3" width="8%" align="center" bgcolor="#eaeaea">订购单位</td>
        <td class="plist_title4_3" width="10%" align="center" bgcolor="#eaeaea">规格</td>
        <td color="#ff00ff" class="plist_title4_3" width="8%" align="center" bgcolor="#eaeaea">优惠折扣</td>
        <td class="plist_title4_3" width="10%" align="center" bgcolor="#eaeaea">小计</td>
        <td class="plist_title4_3" width="8%" align="center" bgcolor="#eaeaea">获得积分</td>
        <td class="plist_title4_3" width="6%" align="center" bgcolor="#eaeaea">收藏</td>
        <td class="plist_title4_3" width="6%" align="center" bgcolor="#eaeaea">删除</td>
      </tr>
      <#assign points=0>
      <#list order.orderItems as orderItem>
	      <tr>
	        <td bgcolor="#ffffff"><a href="#" target="_blank">${orderItem.item_name}</a></td>
	        <td align="center" bgcolor="#ffffff">￥<font color="#ff0000">
	        ${orderItem.b2hprice}元/${orderItem.unit} 
	        </font></td>
	        <td align="center" bgcolor="#ffffff">
	        	<input name="qty" class="plist_input2" value="${orderItem.qty}" onBlur="changeQty(this,'${orderItem.orderItemId}',${orderItem.qty})" type="text">
	        </td>
	        <td align="center" bgcolor="#ffffff">
	        	${orderItem.realunit?if_exists}
	        </td>
	        <td align="center" bgcolor="#ffffff">
	        	<#if orderItem.shape?exists>
	        		${orderItem.shape}${orderItem.realunit?if_exists}约${orderItem.shapweight}${orderItem.unit}
	        	</#if>
	        </td>
	        <td align="center" bgcolor="#ffffff">
		        <#if orderItem.discountRate!=1>
		        		${orderItem.discountRate}
		        </#if>
	        </td>
	        <td align="center" bgcolor="#ffffff">￥${orderItem.totalSum}</td>
	        <td align="center" bgcolor="#ffffff">${orderItem.makepoint}</td>
	        <td align="center" bgcolor="#ffffff"><a href="javascript:onClick=addCollection('${orderItem.item_no}')">收藏</a></td>
	        <td align="center" bgcolor="#ffffff"><a href="removeItem.do?cartItemId=${orderItem.orderItemId?if_exists}">移除</a></td>
	      </tr>
	      <#assign points=points+orderItem.makepoint>
      </#list>
      <tr>
        <td colspan="6" align="right" bgcolor="#efefef">合计：</td>
        <td colspan="1" align="center" bgcolor="#efefef">￥${order.b2hamt} </td>
        <td colspan="1" align="center" bgcolor="#efefef">${points} </td>
        <td colspan="2" align="right" bgcolor="#efefef">&nbsp;</td>
      </tr>
      <#assign totalAmt=totalAmt+order.b2hamt>
   </#list>
    </tbody>
  </table>
  <table class="table3" id="table26" width="100%" bgcolor="#e0e0e0" border="0" cellpadding="5" cellspacing="1">
    <tbody>
      <tr>
        <td class="plist_title4_2" width="100%" align="right" bgcolor="#efefef">购物车预计总金额：￥${totalAmt}</td>
      </tr>
      <tr>
        <td colspan="3" align="right" bgcolor="#ffffff"><table width="80%" border="0" cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <td width="20%" align="center"><input value="清空购物车" onClick="window.location.href='clearCart.do'" name="B4" type="button"></td>
                <td width="18%" align="center"><input name="button" onClick="window.history.go(-1)" value="继续购物" type="button"></td>
                <td width="18%" align="center"><input value="下一步" name="B6" onClick="window.location.href='showOrderCustom.htm'" type="button"></td>
              </tr>
            </tbody>
          </table></td>
      </tr>
    </tbody>
  </table>
  <table class="table3" width="100%" border="0" cellpadding="5" cellspacing="0">
    <tbody>
      <tr>
        <td colspan="5" class="plist_title4_2" align="left" bgcolor="#fcdbba">如果您是第一次在碧家购物,可以获得以下任意一款礼品。(礼品不可退换货,请您谅解!)</td>
      </tr>
      <tr>
        <td valign="bottom" width="15%" align="center" height="80"><img src="img/cx01.jpeg"></td>
        <td valign="bottom" width="15%" align="center"><img src="img/cx02.jpeg"></td>
        <!-- td align="center" valign="bottom" width="15%"><img src="advertise/cx03.jpg"></td-->
        <td valign="bottom" width="15%" align="center"><img src="img/cx04.jpeg"></td>
        <td width="40%" align="left">&nbsp;</td>
      </tr>
      <tr>
        <td align="center">手按充电式手电筒</td>
        <td align="center"> 时尚保温杯 </td>
        <!-- td align="center">迪尼斯毛绒米老鼠 </td-->
        <td align="center">便携式折叠水桶</td>
        <td align="left">&nbsp;</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="foot_outer1">
  <div class="foot02"></div>
  <div class="foot02"></div>
  <div class="foot02"></div>
  <div class="foot02"></div>
  <div class="foot03"></div>
</div>
<#------------------------------ include file  -------------------------------------------->
<#include "/WEB-INF/view/footer.ftl" />
<#------------------------------  include file  ------------------------------------------->
</body>
</html>
